<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>无标题文档</title>

<style>
div{width:200px;height:300px;border:1px solid #ddd;}
</style>
<script src="../第十三章事件/eventObject.js" type="text/javascript"></script>
</head>

<body>
	<form id="form1" name="form1" action="http://www.baidu.com">
    	<!--隐藏的表单字段-->
        <input type="hidden" name="comments"/>
        
    	<input type="submit" value="submit form"/>
    </form>
    
    <div id="richedit"></div>
    
    <iframe name="richedit" style="width:500px;height:500px;" src="black.html"></iframe>
    
    <script> 
		
		var eventObject=new EventFunction();
		
		var form=document.forms[0];
		
		eventObject.addHandler(form, 'submit', function(event){
			
			var target=eventObject.getTarget(event);
			
			target.elements['comments'].value=frames['richedit'].document.body.innerHTML;
			
		});
		
		eventObject.addHandler(form, 'submit', function(event){
			
			var target=eventObject.getTarget(event);
			
			target.elements['comments'].value=document.getElementById('richedit').innerHTML;
			
		});
    </script>
    
</body>
</html>
